package cn.bdqn.utils;

import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.WebRequest;

import java.util.Map;

/*@Component*/
public class MyErrorAttribute extends DefaultErrorAttributes {

    public Map<String,Object> getErrorAttributes(WebRequest webRequest,boolean include){
        Map<String,Object> errorAttribute = super.getErrorAttributes(webRequest,include);
        errorAttribute.put("custommsg","出错啦！");
        errorAttribute.remove("error");
        return errorAttribute;
    }
}
